package com.my.chapter12;

public class practice9 {
    static void f(int index) throws Exception{
        switch (index){
            case 0:throw new MyException1();
            case 1:throw new MyException2();
            case 2:throw new MyException3();
        }
    }

    public static void main(String[] args) {
        int index = 0;
        while(true){
            try {
                f(index++);
            }catch (Exception e){
                e.printStackTrace();
                if(index==3){
                    break;
                }
            }
        }
    }
}

class MyException1 extends Exception{
    public MyException1(){}
    public MyException1(String msg){
        super(msg);
    }

}

class MyException2 extends Exception{
    public MyException2(){}
    public MyException2(String msg){
        super(msg);
    }
}

class MyException3 extends Exception{
    public MyException3(){}
    public MyException3(String msg){
        super(msg);
    }
}